<template>
  <div>
    <div class="notice">
      <form @submit='formSubmit'>
        <input type="text" name="title" placeholder="请输入标题">
        <textarea name="content" placeholder="请输入公告内容"></textarea>
        <button form-type='submit'>创建</button>
      </form>
    </div>
  </div>
</template>
 
<script>
import request from '../../utils/request'
  export default{
    data(){
      return {
        user:''
      }
    },
    
    methods: {
      async formSubmit(e){
        let data ={
          date1:e.mp.detail.value,
          sno:this.user.sno,
          name:this.user.name
        } 
        let result = await request('/notice/create',{data},'GET')
        if(result.status==0){
          wx.redirectTo({
            url:'/pages/notice/main'
          })
        }
    
      }

    },
    mounted() {
      this.user = wx.getStorageSync('user');
      console.log(this.user.sno)
    },
   
  }
</script>

<style scoped>
.notice{
  width:100%;
  height:auto;
}

.notice textarea{
  border:1px solid rgb(129, 109, 109);
  margin:20px;
}

.notice input{
  margin:20px;
}
button{
  background-color: red
}
</style>
 